package com.youlai.system.converter;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.system.common.model.Option;
import com.youlai.system.model.entity.SysQuestion;
import com.youlai.system.model.form.QuestionForm;
import com.youlai.system.model.vo.QuestionPageVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * 问题分类对象转换器
 */
@Mapper(componentModel = "spring")
public interface QuestionConverter {
    Page<QuestionPageVO> entity2Page(Page<SysQuestion> page);

    SysQuestion form2Entity(QuestionForm questionForm);

    QuestionForm entity2Form(SysQuestion entity);

    @Mappings({
            @Mapping(target = "value", source = "id"),
            @Mapping(target = "label", source = "content")
    })
    Option entity2Option(SysQuestion question);


    List<Option> entities2Options(List<SysQuestion> questions);
}
